# Wi-Fi init file

on post-fs-data

on post-fs-data
    # give system access to wpa_supplicant.conf for backup and restore
    mkdir /data/misc/wifi 0770 wifi system
    chmod 0660 /data/misc/wifi/wpa_supplicant.conf
    chmod 0660 /data/misc/wifi/p2p_supplicant.conf
    chown system wifi /data/misc/wifi/wpa_supplicant.conf
    chown system wifi /data/misc/wifi/p2p_supplicant.conf
    mkdir /data/misc/wifi/sockets 0770 wifi wifi
    mkdir /data/misc/wifi/log/ 0770 wifi system
    mkdir /data/misc/dhcp 0775 dhcp dhcp
    chown dhcp dhcp /data/misc/dhcp

    # for WIFI TRP/TIS
    chown system root /data/.psm.info
    chmod 0664 /data/.psm.info

    # for WIFI Antenna Selection
    chown system root /data/.ant.info
    chmod 0664 /data/.ant.info

    # for WIFI Version
    write /data/.wifiver.info 0
    chown system root /data/.wifiver.info
    chmod 0666 /data/.wifiver.info

    # for WIFI MEMDUMP
    write /data/.memdump.info 0
    chown system root /data/.memdump.info
    chmod 0666 /data/.memdump.info

    # for WIFI DONGLE EVENT LOG
    write /data/.logtrace.info 1
    chown system root /data/.logtrace.info
    chmod 0666 /data/.logtrace.info

    # for WIFI Cert
    chmod 0664 /data/.bustxglom.info
    chmod 0664 /data/.roamoff.info
    chmod 0664 /data/.frameburst.info
    chmod 0664 /data/.txbf.info
    # for WIFI MAC address
    mkdir /efs/wifi 0775 radio system
    chown system wifi /efs/wifi/.mac.info
    chmod 0660 /efs/wifi/.mac.info
    start macloader
    # Set permissions for firmware path control
    chown wifi wifi /sys/module/dhd/parameters/firmware_path

on boot
    setprop wifi.interface wlan0

    # Pcie WiFi T-put setting
    write /sys/class/net/wlan0/queues/rx-0/rps_cpus 00

# Run deferred initcalls of builtin kernel modules (bcmdhd)
service wifiloader /system/bin/wifiloader
    class main
    oneshot

service p2p_supplicant /vendor/bin/hw/wpa_supplicant -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf -I/system/etc/wifi/p2p_supplicant_overlay.conf -puse_p2p_group_interface=1p2p_device=1 -m/data/misc/wifi/p2p_supplicant.conf -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0
    class main
    socket wpa_wlan0 dgram 660 wifi wifi
    disabled
    oneshot

service wpa_supplicant /vendor/bin/hw/wpa_supplicant -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf -I/system/etc/wifi/wpa_supplicant_overlay.conf -O/data/misc/wifi/sockets -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0
    class main
    socket wpa_wlan0 dgram 660 wifi wifi
    disabled
    oneshot

# tiburona
# start for WiFi MFG (TestMode)
service mfgloader /system/bin/mfgloader
    class main
    disabled
    oneshot

service wlandutservice /system/bin/wlandutservice
    class main
    user system
    group wifi net_raw net_admin system inet
    disabled
    oneshot

service macloader /system/bin/macloader
    class main
    disabled
    oneshot

on property:init.svc.macloader=stopped
    chown system root /data/.cid.info
    chmod 0664 /data/.cid.info
    chown system root /data/.rev
    chmod 0664 /data/.rev
# end of WiFi MFG (TestMode)
